<template>
  <!-- vue2.0中只能有一个根标签 -->
  <!-- vue3.0中可以写代码片段 frament -->
  <div>
    11
  </div>

  <p>{{$store.state.a}}</p>
  <p>{{$store.getters.newData}}</p>
  <P>{{b}}</P>
  <button @click="fn">该数据</button>
  <button @click="fn1">该数据</button>
</template>
<script>
import { useStore } from 'vuex'

export default {
  name: 'App',
  setup () {
    const store = useStore()
    const b = store.state.a
    console.log(store.getters.newData)
    const fn = () => {
      store.commit('update')
    }

    const fn1 = () => {
      store.dispatch('update')
    }
    return { b, fn, fn1 }
  }

}
</script>
<style lang="less">

</style>
